
<?php echo $this->element('box-search'); ?>

	<div class="content directory">
		<div class="grid-16">
			<?php foreach($industries AS $row): ?>
				<div id="industry-<?php echo $row['Industry']['id']; ?>" class="industry">
					<h4><?php echo $html->link($row['Industry']['name'], array('controller' => 'industries', 'action' => 'details', $row['Industry']['slug'])); ?></h4>
					<ul>
					<?php if (!empty($row['Industry']['Term'])): ?>
					<?php foreach($row['Industry']['Term'] AS $term): ?>
						<li><?php echo $html->link($term['name'], array('controller' => 'industries', 'action' => 'details', $row['Industry']['slug'], $term['slug'])); ?></li>
					<?php endforeach; ?>
					<?php endif; ?>
					</ul>
				</div>
				<script type="text/javascript">position('industry-<?php echo $row['Industry']['id']; ?>');</script>
			<?php endforeach; ?>
		</div>
	</div>

	<script charset="utf-8" type="text/javascript">
		var col1h = 0;
		var col2h = 0;
		var col3h = 0;
		
		function position(id) {
			
		}
		
                function position_rec(id) {
                    if (column_1_height <= column_2_height && column_1_height <= column_3_height) {
                        $(id).style.left = '25px';
                        $(id).style.top = column_1_height + 'px';
                        column_1_height += $(id).getDimensions().height + rec_padding;
                        if (column_1_height > overall_height) overall_height = column_1_height;
                    } else if (column_2_height <= column_3_height) {
                        $(id).style.left = '315px';
                        $(id).style.top = column_2_height + 'px';
                        column_2_height += $(id).getDimensions().height + rec_padding;
                        if (column_2_height > overall_height) overall_height = column_2_height;
                    } else {
                        $(id).style.left = '605px';
                        $(id).style.top = column_3_height + 'px';
                        column_3_height += $(id).getDimensions().height + rec_padding;
                        if (column_3_height > overall_height) overall_height = column_3_height;
                    }

                    $('column_container').style.height = (overall_height - 30) + 'px';   
                    $(id).style.visibility = 'visible';
                }

	</script>